#include "XIndexBufferD3D9.h"

XIndexBufferD3D9::XIndexBufferD3D9(){
	m_buffer = NULL;
	u_size = 0;
}

XIndexBufferD3D9::~XIndexBufferD3D9(){
	if (m_buffer != NULL)
		m_buffer->Release();
}

bool XIndexBufferD3D9::Init(){
	return true;
}

string XIndexBufferD3D9::ToString(){
	return "XMod::XIndexBufferD3D9";
}

void XIndexBufferD3D9::SetIndexBuffer(XIndexBuffer* ptr_indexbuffer){

}
void XIndexBufferD3D9::SetSourceBuffer(void* ptr_buffer, int i_offest, int i_size){
	if (ptr_buffer != NULL){
		byte* ptr_buffer_d3d = NULL;
		if (FAILED(m_buffer->Lock(i_offest, i_size, (void **)&ptr_buffer_d3d, 0)))
			return;
		memcpy(ptr_buffer_d3d, ptr_buffer, i_size);
		m_buffer->Unlock();
	}
}
void XIndexBufferD3D9::GetSourceBuffer(void** ptr_buffer){
	
}
IDirect3DIndexBuffer9* XIndexBufferD3D9::GetBufferD3D(){
	return m_buffer;
}

void XIndexBufferD3D9::SetBufferD3D(IDirect3DIndexBuffer9* buffer){
	m_buffer = buffer;
}